package com.erp.erp_servers.warehouse.imp;

import com.erp.erp_dao.warehouse.IResourceSamplesDao;
import com.erp.erp_entitys.warehouse.entity.ResourceSamplesEntity;
import com.erp.erp_entitys.warehouse.req.ResourceSamplesListReq;
import com.erp.erp_servers.warehouse.IResourceSamplesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName : ResourceSamplesServiceImp
 * @Description : 资源样品实现类
 * @Author : lst
 * @Date: 2020-11-28 15:58
 */
@Service
public class ResourceSamplesServiceImp implements IResourceSamplesService {

    /**
     * 资源样品mapper
     */
    private final IResourceSamplesDao resourceSamplesDao;

    @Autowired
    public ResourceSamplesServiceImp(IResourceSamplesDao resourceSamplesDao) {
        this.resourceSamplesDao = resourceSamplesDao;
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public ResourceSamplesEntity queryById(Integer id) {
        return resourceSamplesDao.queryById(id);
    }

    /**
     * 通过实体作为筛选条件查询
     *
     * @param resourceSamples 实例对象
     * @return 对象列表
     */
    @Override
    public List<ResourceSamplesEntity> queryAll(ResourceSamplesEntity resourceSamples) {
        return resourceSamplesDao.queryAll(resourceSamples);
    }

    /**
     * 获取资源样品集合
     * @param req 查询参数
     * @return 资源样品集合
     */
    @Override
    public List<ResourceSamplesEntity> getResourceSamplesList(ResourceSamplesListReq req) {
        return resourceSamplesDao.getResourceSamplesList(req);
    }

    /**
     * 新增数据
     *
     * @param resourceSamples 实例对象
     * @return 影响行数
     */
    @Override
    public int insert(ResourceSamplesEntity resourceSamples) {
        return resourceSamplesDao.insert(resourceSamples);
    }

    /**
     * 修改数据
     *
     * @param resourceSamples 实例对象
     * @return 影响行数
     */
    @Override
    public int update(ResourceSamplesEntity resourceSamples) {
        return resourceSamplesDao.update(resourceSamples);
    }
}
